<template>
  <div class="cus-card">
    <div
      class="card-header"
      :class="{ 'card-header-2': useLongBg }"
    >
      <div class="name">{{ name }}</div>
      <TabList
        v-if="hideTab"
        :tab-list="tabList"
        :current="current"
        @tabClick="tabClick"
      />
    </div>
    <div
      class="card-content"
      :style="contentStyle"
    >
      <slot></slot>
    </div>
  </div>
</template>

<script>
import TabList from './TabList.vue'
export default {
  components: {
    TabList
  },
  props: {
    name: {
      type: String,
      default: ''
    },
    headerStyle: {
      type: Object,
      default: () => {
        return {}
      }
    },
    contentStyle: {
      type: Object,
      default: () => {
        return {}
      }
    },
    hideTab: {
      type: Boolean,
      default: false
    },
    tabList: {
      type: Array,
      default: () => {
        return []
      }
    },
    current: {
      type: [Number, String],
      default: 0
    },
    useLongBg: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {}
  },
  methods: {
    tabClick(item) {
      this.$emit('tabClick', item)
    }
  }
}
</script>

<style lang="scss" scoped>
.cus-card {
  width: 100%;
  .card-header {
    width: 100%;
    height: 38px;
    line-height: 38px;
    background-image: url('../images/header-card-d.png');
    background-repeat: no-repeat;
    padding-left: 60px;
    padding-right: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    .name {
      color: #fff;
      text-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25);
      font-size: 18px;
      font-weight: bold;
    }
  }
  .card-header-2 {
    background-image: url('../images/header-card-l.png');
  }
  .card-content {
    margin-top: 6px;
    width: 100%;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(112, 140, 197, 0.3);
    background: rgba(23, 43, 74, 0.8);
  }
}
</style>
